using System;
using System.Collections.Generic;
using System.Text;
using SharpMud.Server.Systems;
using SharpMud.MudLib.Common.Resourcing;

namespace SharpMud.MudLib.Common.Interaction.Commands
{
    /// <summary>
    /// 
    /// </summary>
    public class CommandManager : PulsarServerSystem, ICommandManager
    {
        private PrivateResourcingHelper _ResourcingHelper;

        #region Optional Overrides
        protected override void _Initialize()
        {
            base._Initialize();
            //Initialize configuration and such
        }

        protected override void _Start()
        {
            base._Start();
            //Compile commands and load them into memory
        }

        protected override void _Stop()
        {
            base._Stop();
            //Remove all in-memory references to compiled commands and compiled
            //command instances.
        }

        protected override void Pulse()
        {
            base.Pulse();
            //Nothing to do here, because commands are invoked by externally by
            //the player sessions
        }

        protected override void _Dispose()
        {
            base._Dispose();
            //Dispose of any resources
        }
        #endregion

        #region IGuidIdentifiedResourceHost Members

        public bool IsDefined(Guid guid)
        {
            return _ResourcingHelper.IsDefined(guid);
        }

        public object GetResource(Guid guid)
        {
            return _ResourcingHelper.GetResource(guid);
        }

        #endregion

        #region IUriIdentifiedResourceHost Members

        public Uri BaseUri
        {
            get { return _ResourcingHelper.BaseUri; }
        }

        public bool IsDefined(Uri resourceIndicator)
        {
            return _ResourcingHelper.IsDefined(resourceIndicator);
        }

        public object GetResource(Uri resourceIndicator)
        {
            return _ResourcingHelper.GetResource(resourceIndicator);
        }

        #endregion

        #region ICommandManager Members

        /// <summary>
        /// 
        /// </summary>
        /// <param name="actor"></param>
        /// <param name="commandLine"></param>
        public void ExecuteCommand(SharpMud.MudLib.Common.Entities.ICharacter actor, string commandLine)
        {
            throw new Exception("The method or operation is not implemented.");
        }

        #endregion
    }
}